<?php
if(!defined('MY_ROOT'))
{throw new Exception('Access Denied');}
$ajax=($_POST['inajax']==1) ? true : false ;
if($_POST['password']!=$_POST['rpassword'])
{
showmessage('alert',_('password_dismatch'),$ajax);
throw new Exception();
}
$member=$_G['hwnd']['member'];
$result=$member->chpasswd($_G['username'],$_POST['oldpass'],$_POST['password']);
$ajax=($_POST['inajax']==1);
switch($result)
{
case 1;
showmessage('success',_('Password changed'),$ajax,$_POST['return']);
break;
case -1;
showmessage('alert',_('Password not changed'),$ajax,$_POST['return']);
break;
case -2:
showmessage('alert',_('Old Password not match'),$ajax,$_POST['retutn']);
break;
default:
throw new Exception();
}

?>
